home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
emulator
/
bsvc-1.000
/
bsvc-1
/
bsvc-1.0.4
/
src
/
SimHector
/
cpu
/
RegisterSet.hxx
< prev
next >
Wrap
Text File
|
1995-07-26
|
2KB
|
82 lines
///////////////////////////////////////////////////////////////////////////////
//
// RegisterSet.hxx - The Hector 1600's Register Set
//
// By: Bradford W. Mott
// December 3,1993
//
///////////////////////////////////////////////////////////////////////////////
#ifndef REGISTERSET_HXX
#define REGISTERSET_HXX
#include <assert.h>
// Register information structure
struct RegisterData {
char* name;
char* description;
};
// Indices into the register array
const int SWI=11;
const int NMI=12;
const int MSK=13;
const int SP=14;
const int PC=15;
const int T1=16;
const int T2=17;
///////////////////////////////////////////////////////////////////////////////
// The Hector 1600's Register Set Class
///////////////////////////////////////////////////////////////////////////////
class RegisterSet {
private:
// Number of user registers (User's view doesn't count T1 & T2)
const int number_of_user_registers;
// Total number of registers
const int number_of_registers;
// Array of static information for each user register
static RegisterData register_data[];
// Pointer to an array of values for each register
unsigned long *register_value;
public:
RegisterSet();
~RegisterSet();
// Return the Number Of User Registers
inline int NumberOfUserRegisters()
{ return(number_of_user_registers); }
// Return the Number Of Registers
inline int NumberOfRegisters()
{ return(number_of_registers); }
// Get a Register value from the register file
inline unsigned long GetRegister(int index)
{
assert(index < number_of_registers);
return(register_value[index]);
}
// Store a value in one of the registers
inline void SetRegister(int index, unsigned long value)
{
assert(index < number_of_registers);
register_value[index]=value & 0xffff;
}
// Get the RegisterData structure for the indexed registers
inline RegisterData GetRegisterData(int index)
{
assert(index < number_of_user_registers);
return(register_data[index]);
}
};
#endif